using System;
using System.Windows;
using System.Windows.Controls;
namespace MicroMsg.UI.UserContrl
{
	public class MMListBoxItem : ListBoxItem
	{
		private object _maskedContent;
		private DataTemplate _maskedContentTemplate;
		public bool isImgLoaded;
		private bool cachedIsVisible;
		public bool Masked
		{
			get;
			set;
		}
		internal MMListBox Owner
		{
			get;
			set;
		}
		public bool IsVisible
		{
			get
			{
				if (this.Owner == null)
				{
					return false;
				}
				if (this.Owner.GetVisibleItemsAsMutableList().Contains(this))
				{
					this.cachedIsVisible = true;
				}
				else
				{
					this.cachedIsVisible = false;
				}
				return this.cachedIsVisible;
			}
		}
		public MMListBoxItem()
		{
			base.set_HorizontalAlignment(3);
			base.set_HorizontalContentAlignment(3);
		}
		public void MaskContent()
		{
			if (!this.Masked)
			{
				this._maskedContent = base.get_Content();
				this._maskedContentTemplate = base.get_ContentTemplate();
				base.set_Content(null);
				base.set_ContentTemplate(null);
				this.Masked = true;
			}
		}
		public void UnmaskContent()
		{
			if (this.Masked)
			{
				base.set_ContentTemplate(this._maskedContentTemplate);
				base.set_Content(this._maskedContent);
				this._maskedContentTemplate = null;
				this._maskedContent = null;
				this.Masked = false;
			}
		}
		internal void SetIsVisible(bool isVisible, int currentSnapshotVersion)
		{
			BaseDataType baseDataType = base.get_DataContext() as BaseDataType;
			this.cachedIsVisible = isVisible;
			if (isVisible && baseDataType != null)
			{
				baseDataType.LoadLazyData();
			}
		}
	}
}
